const db = require("./db");

module.exports = async function (arr) {
  const newArr = [];
  for (let item in arr) {
    if (!arr[item].createdById) {
      return;
    }
    const { password, id, ...others } = (
      await db(`select * from user where id=${arr[item].createdById}`)
    )[0];
    newArr.push({ ...arr[item], ...others });
  }
  return newArr;
};
